<?php
include('netpayclient.php');
require ('WebPathSettings.php');
require('./libraries/template.config.php');
if(is_file("./MerPrK_808080112092557_20121120114322.key")){
	echo '读取文件成功';
}

$merid = buildKey("MerPrK_808080112092557_20121120114322.key");

print($merid);

if(!$merid) {
	echo "导入私钥文件失败！";
	exit;
}

$ordid = "00" . date('YmdHis');//订单号
$transamt = padstr('1',12);//交易金额
$curyid = "156";//货币代码
$transdate = date('Ymd');//交易时间
$transtype = "0001";//交易类型（0001消费0002退货）
$version = "20070129";//版本
$pagereturl = "http://lexiangpai.cn/paypgreturn.php";
$bgreturl = "http://lexiangpai.cn/paypgreturn.php";
$priv1="abc";
$plain = $merid . $ordid . $transamt . $curyid . $transdate . $transtype . $priv1;

//对订单的签名
$chkvalue =  signOrder($merid, $ordid, $transamt, $curyid, $transdate, $transtype,$priv1);
//对一段字符串的签名
#$chkvalue = signOrder($plain);
if (!$chkvalue) {
echo "签名失败！";
exit;
}

#$str = buildKey("/MerPrK_808080231802511_20121116160224.key");
$smarty->assign("MerId","808080112092557");
$smarty->assign("ordid",$ordid);
$smarty->assign("curyid",$curyid);
$smarty->assign("TransDate",$transdate);
$smarty->assign("transtype",$transtype);
$smarty->assign("transamt",$transamt);
$smarty->assign("version",$version);
$smarty->assign("chkvalue",$chkvalue);

#echo (SYS_DIR);

$smarty->display('pay.html');

?>